﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MathTest {
    class TestMethod {

        public static void useMath() {
            Console.WriteLine("请输入第一个实数");
            double number1 = double.Parse(Console.ReadLine());
            Console.WriteLine("请输入第二个实数");
            double number2 = double.Parse(Console.ReadLine());

            Console.WriteLine("其中最大的数为：" + Math.Max(number1, number2));
            Console.WriteLine("其中最小的数为：" + Math.Min(number1, number2));
        }

        public static void getDaffodilNumber() {
            for (int i = 100; i <= 999; i++) {
                int number1 = i / 100;
                int number2 = (i % 100) / 10;
                int number3 = i % 10;
                if (Math.Pow(number1, 3) + Math.Pow(number2, 3) + Math.Pow(number3, 3) == i) {
                    Console.WriteLine(i);
                }
            }
        }

        public static void printRegular() {
            Console.WriteLine("请输入a的值");
            double a = double.Parse(Console.ReadLine());
            Console.WriteLine("请输入b的值");
            double b = double.Parse(Console.ReadLine());
            Console.WriteLine("请输入c的值");
            double c = double.Parse(Console.ReadLine());

            double x = a * Math.Pow(b, 3) + 5 * Math.Log((1 + Math.Pow(c, 2)));

            Console.Write("科学计数法：");
            Console.WriteLine("{0,6:E}", x);
            Console.Write("定点表示法(保留两位小数)：");
            Console.WriteLine("{0,10:f2}", x);
            Console.WriteLine("普通表示法：" + x);
        }

        public static void printSinAndCos() {
            Console.WriteLine("打印100以内奇数的sin ，cos ，tan值");
            for (int i = 1; i <= 100; i++) {
                if (i % 2 != 0) {
                    Console.WriteLine(i + "的sin值为：" + Math.Sin(i));
                    Console.WriteLine(i + "的cos值为：" + Math.Cos(i));
                    Console.WriteLine(i + "的tan值为：" + Math.Tan(i));
                    Console.WriteLine();
                }
            }
        }

        public static int result = 1;

        public static void printFactorial() {
            Console.WriteLine("请输入任意整数");
            int number = int.Parse(Console.ReadLine());
            getIt(number);
        }

        public static void getIt(int number) {
            if (number == 1 || number < 1) {
                Console.WriteLine("该数的阶乘为：" + result);
                return;
            }
            result = (number * (number - 1)) * result;
            number -= 2;
            getIt(number);
        }
    }
}
